package com.gc.business.service.impl;

import java.util.List;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.gc.common.utils.StringUtils;
import org.springframework.stereotype.Service;
import com.gc.business.mapper.UpkeepProjectRecordMapper;
import com.gc.business.domain.UpkeepProjectRecord;
import com.gc.business.service.IUpkeepProjectRecordService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;

/**
 * 电梯保养项目记录 服务层实现
 * 
 * @author hruiyan
 * @date 2020-11-18
 */
@Slf4j
@Service
public class UpkeepProjectRecordServiceImpl extends ServiceImpl<UpkeepProjectRecordMapper, UpkeepProjectRecord> implements IUpkeepProjectRecordService {

    @Override
    public List<UpkeepProjectRecord> list(UpkeepProjectRecord upkeepProjectRecord){
        LambdaQueryWrapper<UpkeepProjectRecord> wrapper = new LambdaQueryWrapper<>();
        if(upkeepProjectRecord != null){
            if(StringUtils.isNotEmpty(upkeepProjectRecord.getRecordId())){
                wrapper.eq(UpkeepProjectRecord::getRecordId, upkeepProjectRecord.getRecordId());
            }
            if(StringUtils.isNotEmpty(upkeepProjectRecord.getUpkeepId())){
                wrapper.eq(UpkeepProjectRecord::getUpkeepId, upkeepProjectRecord.getUpkeepId());
            }
            if(StringUtils.isNotEmpty(upkeepProjectRecord.getProjectName())){
                wrapper.like(UpkeepProjectRecord::getProjectName, upkeepProjectRecord.getProjectName());
            }
            if(StringUtils.isNotEmpty(upkeepProjectRecord.getProjectRequire())){
                wrapper.eq(UpkeepProjectRecord::getProjectRequire, upkeepProjectRecord.getProjectRequire());
            }
            if(StringUtils.isNotEmpty(upkeepProjectRecord.getUpkeepResult())){
                wrapper.eq(UpkeepProjectRecord::getUpkeepResult, upkeepProjectRecord.getUpkeepResult());
            }
            if(StringUtils.isNotEmpty(upkeepProjectRecord.getProjectType())){
                wrapper.eq(UpkeepProjectRecord::getProjectType, upkeepProjectRecord.getProjectType());
            }
            if(StringUtils.isNotEmpty(upkeepProjectRecord.getCreateBy())){
                wrapper.eq(UpkeepProjectRecord::getCreateBy, upkeepProjectRecord.getCreateBy());
            }
            if(StringUtils.isNotEmpty(upkeepProjectRecord.getCreateTime())){
                wrapper.eq(UpkeepProjectRecord::getCreateTime, upkeepProjectRecord.getCreateTime());
            }
            if(StringUtils.isNotEmpty(upkeepProjectRecord.getUpdateBy())){
                wrapper.eq(UpkeepProjectRecord::getUpdateBy, upkeepProjectRecord.getUpdateBy());
            }
            if(StringUtils.isNotEmpty(upkeepProjectRecord.getUpdateTime())){
                wrapper.eq(UpkeepProjectRecord::getUpdateTime, upkeepProjectRecord.getUpdateTime());
            }
            if(StringUtils.isNotEmpty(upkeepProjectRecord.getRemark())){
                wrapper.eq(UpkeepProjectRecord::getRemark, upkeepProjectRecord.getRemark());
            }
        }
        return baseMapper.selectList(wrapper);
    }
}
